getRegistry

I'm trying to read a registry value that I know exists, but get nothing:

print getRegistry("HKEY_CURRENT_USER\\Environment", "OneDrive")

But this works and provides the expected result:

print getRegistry("HKEY_CURRENT_USER\\Software\\Telelogic\\DOORS\\9.6\\Config", "LOCALDATA")

The only difference I can think of is that the OneDrive registry value type is REG_EXPAND_SZ, while the readable LOCALDATA registry value type is REG_SZ.

Any explanation? Any solution for reading the OneDrive value?

 


morast - Thu Dec 13 15:56:48 EST 2018

Re: getRegistry
Mathias Mamsch - Fri Dec 14 02:39:00 EST 2018

Explanation: It seems that getRegistry is one of these functions that IBM put into DXL to satisfy their own use cases not thinking about the needs of their customers and it does not support REG_EXPAND_SZ

Solution: You could use a COM object or a system shell to read the value, e.g.:

OleAutoObj obj = oleCreateAutoObject "WScript.Shell"
OleAutoArgs args = create()
put(args, "HKEY_CURRENT_USER\\Environment\\TMP")
string s = null
oleMethod(obj, "RegRead", args, s)
print s

Hope that helps, regards, Mathias

Re: getRegistry
morast - Fri Dec 14 12:11:40 EST 2018

Mathias Mamsch - Fri Dec 14 02:39:00 EST 2018

Explanation: It seems that getRegistry is one of these functions that IBM put into DXL to satisfy their own use cases not thinking about the needs of their customers and it does not support REG_EXPAND_SZ

Solution: You could use a COM object or a system shell to read the value, e.g.:

OleAutoObj obj = oleCreateAutoObject "WScript.Shell"
OleAutoArgs args = create()
put(args, "HKEY_CURRENT_USER\\Environment\\TMP")
string s = null
oleMethod(obj, "RegRead", args, s)
print s

Hope that helps, regards, Mathias

Yes, that will work! Many thanks for solution and explanation.

Somewhat annoyinbg, but that is hardly your fault :-)